Problem:
After updating the JS-part of any package, the user is forced to clear
the browser cache.
Fix:
Each time a package is removed or installed, the contents of the
"/lib/apk/db/installed" file are changed.
This fix add the modification time of the "/lib/apk/db/installed" file
to the version of the main LuCI package (for each js-file).
Signed-off-by: Oleg S <[email protected]>
// Licensed to the public under the Apache License 2.0.
-import { access, basename } from 'fs';
+import { access, basename, stat } from 'fs';
import { cursor } from 'uci';
const template_directory = '/usr/share/ucode/luci/template';
self.env.media = media;
self.env.theme = basename(media);
self.env.resource = uci.get('luci', 'main', 'resourcebase');
+ self.env.pkgs_update_time = stat('/lib/apk/db/installed')?.mtime ?? stat('/usr/lib/opkg/status')?.mtime ?? 0;
self.env.include = (...args) => self.render_any(...args);
return self;
include(`themes/${theme}/header`);
-%}
-<script src="{{ resource }}/luci.js"></script>
+<script src="{{ resource }}/luci.js?v={# PKG_VERSION #}-{{ pkgs_update_time }}"></script>
<script>
L = new LuCI({{ replace(`${ {
media : media,